理解maven的parent标签里面的relativePath 您所在的位置:网站首页 spring boot starter parent的作用 理解maven的parent标签里面的relativePath

理解maven的parent标签里面的relativePath

2023-10-17 14:11| 来源: 网络整理| 查看: 265

经常看到用Spring Initializr建立spring boot项目,生成的pom.xml包含如下parent:

org.springframework.boot spring-boot-starter-parent 2.6.2

也会看到一些maven module项目包含下面relativePath形式:

admin org.example 1.0-SNAPSHOT ../pom.xml

也有不写relativePath的,直接如下:

admin org.example 1.0-SNAPSHOT

参考官方文档发现,relativePath是与从哪里继承相关联的,默认③什么都不写等同于②,像①那种是不依赖本地parent pom,直接从reposity拉取,

Maven looks for the parent pom first in the reactor of currently building projects, then in this location on the filesystem, then the local repository, and lastly in the remote repo.

寻找parent pom优先级:本地项目>文件系统>本地库>远程库,而springboot默认都是直接从远程库拉取的。

参考文档:

Understanding Maven’s “relativePath” Tag for a Parent POM:https://www.baeldung.com/maven-relativepath

 



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有